7.7 Suppose you decided to rewrite the VeryLongInt class, from Chapter 6, with a LinkedList instead of an ArrayList. The main change is to replace each occurrence of the identifier ArrayList with LinkedList. Another change, in the String -parameter constructor, is to replace digits = new ArrayList with digits = new LinkedList But the add method will now take quadratic time because the least method will now take linear time. Modify the least method-including its heading-so that its worstTime(n) will be constant. Make the corresponding changes to the add method so that method will take only linear time. | |
| View Solution | |
| << Back | Next >> |